//
//  MXFindSearchCollectionViewCell.m
//  MXの衣柜
//
//  Created by 马霄 on 15/8/18.
//  Copyright (c) 2015年 霄 马. All rights reserved.
//

#import "MXFindSearchCollectionViewCell.h"
#import "MXFindSearchDetailVC.h"
@implementation MXFindSearchCollectionViewCell
- (void)dealloc
{
    [_naviSearch release];
    [_signLabel release];
    [super dealloc];
}

-(instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        self.signLabel = [[[UILabel alloc] init] autorelease];
        self.signLabel.backgroundColor = [UIColor whiteColor];
        self.signLabel.textAlignment = NSTextAlignmentCenter;
        self.signLabel.layer.borderWidth = 1;
        self.signLabel.layer.cornerRadius = 5;
        self.signLabel.layer.borderColor = [UIColor blueColor].CGColor;
        self.signLabel.userInteractionEnabled = YES;
        [self.contentView addSubview:self.signLabel];
        
        UITapGestureRecognizer *tap  = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(topViewAction)];
        [self.signLabel addGestureRecognizer:tap];
        [tap release];
        
    }
    return self;
}
-(void)layoutSubviews
{
    [super layoutSubviews];
    CGFloat signLabelX = 0;
    CGFloat signLabelY = 0;
    CGFloat signLabelW = self.contentView.frame.size.width;
    CGFloat signLabelH = self.contentView.frame.size.height;
    self.signLabel.frame = CGRectMake(signLabelX, signLabelY, signLabelW, signLabelH);
}

-(void)getInfo:(NSString *)signString
{
    self.signLabel.text = signString;
}



- (void)topViewAction
{
    MXFindSearchDetailVC *detailVC = [[[MXFindSearchDetailVC alloc] init] autorelease];
    
    detailVC.searchResult = self.signLabel.text;
    
    [self.naviSearch pushViewController:detailVC animated:YES];
}


@end
